package com.tuling.plugins;

import org.apache.ibatis.executor.parameter.ParameterHandler;
import org.apache.ibatis.mapping.MappedStatement;
import org.apache.ibatis.plugin.*;

import java.sql.PreparedStatement;
import java.util.Properties;

/***
 * @Author 徐庶   QQ:1092002729
 * @Slogan 致敬大师，致敬未来的你
 */
@Intercepts({
        @Signature(type = ParameterHandler.class, method = "setParameters", args = {PreparedStatement.class})
})
public class MyParameterHandlerInterceptor implements Interceptor {

    @Override
    public Object intercept(Invocation invocation) throws Throwable {
        System.out.println("MyParameterHandlerInterceptor 拦截 ParameterHandler#setParameters ");
        Object[] args = invocation.getArgs();
        return invocation.proceed();
    }



    // 加载的时候调用， 设置属性初始化
    @Override
    public void setProperties(Properties properties) {
        System.out.println("MyParameterHandlerInterceptor setProperties()......");
    }
}